let myAdd: (x: number, y: number) => number =
    function(x: number, y: number): number { return x + y; };
let func = function (x:number,y:number):number {
    return x+y;
}
let deck = {
    suits: ["hearts", "spades", "clubs", "diamonds"],
    cards: Array(52),
    createCardPicker: function() {
        return ()=> {
            let pickedCard = Math.floor(Math.random() * 52);
            let pickedSuit = Math.floor(pickedCard / 13);

            return {suit: this.suits[pickedSuit], card: pickedCard % 13};
        };
    }
}

let cardPicker = deck.createCardPicker();
let pickedCard = cardPicker();

//console.log("card: " + pickedCard.card + " of " + pickedCard.suit);

function identity<T>(arg: T): T {
    return arg;
}

let myIdentity: <T>(arg: T) => T = identity;

interface length {
    length:number;
}

function leng <T extends length>(arg:T){
    //console.log(arg.length);
}
leng("8");
leng({length:4,wid:333});
enum FileAccess {
    // constant members
    None,
    Read    = 1 << 1,
    Write   = 1 << 2,
    ReadWrite  = Read | Write,
    // computed member
    G = "123".length
}

console.log(FileAccess.Read);
console.log(FileAccess.Write);
console.log(FileAccess.ReadWrite);